If you are looking for ways to completely remove the All, Published, and Trash in WordPress admin dashboard posts or custom post types. Then this article will provide you with complete steps to make it possible for you.
By default, WordPress displays all pages/posts in the admin area’s list, regardless of whether they are published or not. If you will refer to the below screenshot then you can see the count of All, Published, and trash.
Now, we want to remove the All and trash option from the above image place. Sometimes you will get more options in your dashboard like pending, draft.
The WP_Posts_List_Table class extends WP_List_Table and within the WP_List_Table::views() method we have the following dynamic views filter:
/**
* Filter the list of available list table views.
*
* The dynamic portion of the hook name, $this->screen->id, refers
* to the ID of the current screen, usually a string.
*
* @since 3.5.0
*
* @param array $views An array of available list table views.
*/
$views = apply_filters( "views_{$this->screen->id}", $views )
So we can use the generated views_edit-post filter to adjust the views of the post list table. I found this code to from here
Are you want to get implementation help, or modify or extend the functionality?
For Example: Suppose I have a custom post type named recipe. then I will call the filter "view_edit-recipe".
Note: the "all" and "mine" status links are hard-coded in the get_views() method of the WP_Posts_List_Table Class and aren't filterable.
Are you want to get implementation help, or modify or extend the functionality of this script? submit your paid request
Conclusion
Well, In this article you will get the complete steps to Disable (or Remove) “All Posts, Published, and Trash” in Dashboard Posts. You can extend the functionality as per your requirement. I hope you found this tutorial helpful for your project. Keep learning!.
Pradeep Maurya is the Professional Web Developer & Designer and the Founder of “Tutorials website”. He lives in Delhi and loves to be a self-dependent person. As an owner, he is trying his best to improve this platform day by day. His passion, dedication and quick decision making ability to stand apart from others. He’s an avid blogger and writes on the publications like Dzone, e27.co
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy
Privacy Overview
This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.